def crc16(value):
	crc=0
	for char in value:
		crc  = (((crc >> 8)&0xff) | (crc << 8))&0xffff
		crc ^= ord(char)
		crc&=0xffff
		crc ^= (crc & 0xff) >> 4
		crc&=0xffff
		crc ^= (crc << 8) << 4
		crc&=0xffff
		crc ^= ((crc & 0xff) << 4) << 1;
		crc&=0xffff
	return crc
